/********************************************************
 *  ██████╗  ██████╗████████╗██╗
 * ██╔════╝ ██╔════╝╚══██╔══╝██║
 * ██║  ███╗██║        ██║   ██║
 * ██║   ██║██║        ██║   ██║
 * ╚██████╔╝╚██████╗   ██║   ███████╗
 *  ╚═════╝  ╚═════╝   ╚═╝   ╚══════╝
 * Geophysical Computational Tools & Library (GCTL)
 *
 * Copyright (c) 2023  Yi Zhang (yizhang-geo@zju.edu.cn)
 *
 * GCTL is distributed under a dual licensing scheme. You can redistribute 
 * it and/or modify it under the terms of the GNU Lesser General Public 
 * License as published by the Free Software Foundation, either version 2 
 * of the License, or (at your option) any later version. You should have 
 * received a copy of the GNU Lesser General Public License along with this 
 * program. If not, see <http://www.gnu.org/licenses/>.
 * 
 * If the terms and conditions of the LGPL v.2. would prevent you from using 
 * the GCTL, please consider the option to obtain a commercial license for a 
 * fee. These licenses are offered by the GCTL's original author. As a rule, 
 * licenses are provided "as-is", unlimited in time for a one time fee. Please 
 * send corresponding requests to: yizhang-geo@zju.edu.cn. Please do not forget 
 * to include some description of your company and the realm of its activities. 
 * Also add information on how to contact you by electronic and paper mail.
 ******************************************************/

#ifndef _GCTL_MATH_EXT_H
#define _GCTL_MATH_EXT_H

namespace gctl
{
    void DTfunc(double **a,int m,int n,double A,double B,int sw);	
    void DTari(double **a,int m,int n,double A,int sw);	
    void DTfilter(double **a,int m,int n,double A,double B,double Q,int sw);	
    void ext(double **a,int m,int n,int mx,int nx);
    void MaxMin(double **a,int m,int n,double *MxMn);
    void intp(double **a,int m,int n,int mIns,int nIns);
    double int4p(double x,double d,double y1,double y2,double y3,double y4);
    double prep(double **zr,double **zi,int m,int n,int m1,int n1,int np,int nq);
    void fft1(double *ar,double *ai,int m,int n,int key);
    void fft(double **zr,double **zi,int m1,int n1,int me,int ne,int key);
    void fact(double **s,double *x,double *y,double *g,double *b,int mt,int n);
    void fact1(double **s,double *x,double *y,double *g,double *b,int mt,int n,int xLt,int yLt);
    void tsv(double *s,double x,double y,int n);
    void tsv1(double *s,double x,double y,int n,int xLt,int yLt);
    void tran(double **a,int n);
    void metrimult(double **a,double **b,int m,int n,int l,double **c);
    void svd_standalone(double **a,int m,int n,double **u,double **v,double *q,int Index);
}

#endif // _GCTL_MATH_EXT_H